package group.program.Controller;

import group.program.pojo.trafficPojo.Result;
import group.program.utils.OSSUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
@Slf4j
@RestController
public class OSSController {
    @Autowired
    private OSSUtils ossUtils;
    //文件上传阿里云
    @PostMapping("/Upload")
    public Result upload(MultipartFile file) throws IOException {
        String url= ossUtils.upload(file);
        log.info("上传文件的url为：{}",url);
        return Result.success(url);
    }
}
